regular expression "(?<!^)(?=[A-Z])"

Posted by imad on Stack Overflow See other posts from Stack Overflow or by imad
Published on 2012-06-03T10:26:58Z Indexed on 2012/06/03 10:40 UTC
Read the original article Hit count: 95

Filed under:
|

I spent like three hours trying to understant how does "(?<!^)(?=[A-Z])" works to split at tring according to capital letters i.e.

string[] s = Regex.Split("TheWorldWithoutStrangers", "(?<!^)(?=[A-Z])");

How does it work !! I do understand what is the meaning of each char in the above expression, but I do not get how does it work together. why "(? < !^)([A-Z])" doesnot work ? it means that whenever you find a captial letter that is not after a new line, then split, am I right ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex